const shelljs = require('shelljs')
const path = require('path'),
  fs = require('fs')

if (fs.existsSync(path.resolve(process.cwd(), './lib'))) {
  // 拷贝 lib 目录到 lib-copy
  shelljs.cp('-R', path.resolve(process.cwd(), './lib'), path.resolve(process.cwd(), 'lib-copy'))

  // 递归删除 lib 目录中所有 __tests__ 文件夹
  shelljs.rm('-rf', path.resolve(process.cwd(), './lib/**/__tests__'))

  // 递归删除 lib 目录中所有 __mocks__ 文件夹
  shelljs.rm('-rf', path.resolve(process.cwd(), './lib/**/__mock__'))
}
